﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Windows.Controls;
using System.Windows;

namespace Modules.Core {
    public class BaseProductControlViewModel : BaseViewModel {
        public TextBox TxtProductId { get; set; }
        public TextBox TxtManufacturerName { get; set; }
        public TextBox TxtProviderName { get; set; }
        public TextBox TxtProductName { get; set; }
        public TextBox TxtPurchasePrice { get; set; }
        public TextBox TxtSalePrice { get; set; }
        public TextBox TxtRemaining { get; set; }
        public TextBox TxtNote { get; set; }

        public BaseProductControlViewModel(TextBox txtProductId, TextBox txtManufacturerName,
            TextBox txtProviderName, TextBox txtProductName, TextBox txtPurchasePrice,
            TextBox txtSalePrice, TextBox txtRemaining, TextBox txtNote) {
            this.TxtManufacturerName = txtManufacturerName;
            this.TxtNote = txtNote;
            this.TxtProductId = txtProductId;
            this.TxtProductName = txtProductName;
            this.TxtProviderName = txtProviderName;
            this.TxtPurchasePrice = txtPurchasePrice;
            this.TxtRemaining = txtRemaining;
            this.TxtSalePrice = txtSalePrice;
        }

        public virtual void DoAddProduct() {
        }

        public override void DoClearFields() {
            TxtManufacturerName.Text = string.Empty;
            TxtNote.Text = string.Empty;
            TxtProductId.Text = string.Empty;
            TxtProductName.Text = string.Empty;
            TxtProviderName.Text = string.Empty;
            TxtPurchasePrice.Text = string.Empty;
            TxtRemaining.Text = string.Empty;
            TxtSalePrice.Text = string.Empty;
        }

        public override bool CheckIsNotNull() {
            return TxtManufacturerName.Text != " " &&
                TxtNote.Text != " " &&
                TxtProductId.Text != " " &&
                TxtProductName.Text != " " &&
                TxtProviderName.Text != " " &&
                TxtPurchasePrice.Text != " " &&
                TxtRemaining.Text != " " &&
                TxtSalePrice.Text != " ";
        }

    }
}
